Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Finder Guide /
Chapter 3 - Finder Commands / Command Definitions


Open

An Open command is a request to open an object. The Finder version of the Open command is similar to the version described in the AppleScript Language Guide, except that the Finder's Open command can open objects such as application files, folders, suitcases, and disks as well as files, and in the case
of document files allows you to specify the application that opens them.

SYNTAX
open referenceToObject [ using referenceToApplication ]
PARAMETER
referenceToObject
A reference to the object to be opened or a list of references.
Class: Reference or list of references
referenceToApplication
A reference to the application file with which you want to open the document files specified by referenceToObject.
Class: Reference or list of references
Default value: None
RESULT
Reference to the opened object or a list of references.

EXAMPLES
This script opens a file and a folder:

tell application "Finder"   open {file "My File" of startup disk, ¬
      folder "My Folder" of startup disk}
end tell
This script opens a text file using the Scriptable Text Editor:

tell application "Finder"   open file "Text File" of startup disk using ¬
      application file "Scriptable Text Editor" ¬
      of startup disk
end tell
NOTES
If one of the objects specified by referenceToObject is already open, it remains open and its window becomes the frontmost window.

The statement open items in referenceToContainer (where referenceToContainer is a reference to any container) won't compile. Instead, use the statement open every item of referenceToContainer.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996